package com.wly.adapter
{
	import adapter.common.AdapterBase;
	
	import com.wly.ui.FightScene;
		
	public class FightSceneAdapter extends AdapterBase
	{		
		private var _fightSelectGridAdapter:FightSelectGridAdapter;
		private var _selfGridAdapter:FightGridAdapter;
		private var _enemyGridAdapter:FightGridAdapter;
		
		public function FightSceneAdapter()
		{
			super();
			
			init();
		}
		
		private function init():void
		{
			_fightSelectGridAdapter = new FightSelectGridAdapter;
			_selfGridAdapter        = new FightGridAdapter;
			_enemyGridAdapter       = new FightGridAdapter;
		}
		
		protected function get fightScene():FightScene
		{
			return ui as FightScene;
		}
		
		override protected function onUIAttach():void
		{
			if(fightScene)
			{
				if(fightScene.selfFightGrid)
				{
					_fightSelectGridAdapter.attachUI(fightScene.selfFightGrid);
					
				}
				
				if(fightScene.enemyFightGrid)
				{
					_enemyGridAdapter.attachUI(fightScene.enemyFightGrid);
				}
				
				if(fightScene.fightSelectGrid)
				{
					_fightSelectGridAdapter.attachUI(fightScene.fightSelectGrid);
				}
			}
			
		}
	}
}